package com.sghd.pojo.dialog;

/**
 * @author frank
 * @date 2018-08-15 15:23
 * @desc
 **/

import com.sghd.common.utils.json.JsonUtils;

import static com.sghd.pojo.dialog.WindowInfo.*;


/**
 * @author frank
 *
 * 弹窗枚举内容
 * */
public enum Window {
    /***/
    UNKNOWN_ERROR("发生了未知错误，请联系管理员！", WINDOW_F, BT_TOHALL),
    /***/
    PLAYER_INFO_FAIL("获取玩家信息失败", WINDOW_T, BT_TOHALL),
    /***/
    REPETITION_LOGIN("您的账号在其它地方登录了,您被挤出游戏,请检查是否是本人行为", WINDOW_T, BT_TOHALL),
    /***/
    OTHER_ROOM("你当前正处于另一个房间]中", WINDOW_T, BT_TOHALL),
    /***/
    SETTLE_FAIL("结算失败", WINDOW_F, BT_TOHALL),
    /***/
    PLAYER_NOT_FOUND("未找到该玩家", WINDOW_T, BT_TOHALL),
    /***/
    NOT_ENOUGH_MONEY("金币不足", WINDOW_F, BT_TOHALL),
    /***/
    SERVER_CLOSED("服务器维护中....", WINDOW_T, BT_TOHALL),
    /***/
    PLAYER_ALREADY_INROOM("你已经在这个房间里面", WINDOW_F, BT_TOHALL),
    /***/
    TOKEN_FAIL("非法连接", WINDOW_T, BT_TOHALL);
    private String content;
    private String type;
    private int func;

    private Window(String content, String type, int func) {
        this.content = content;
        this.type = type;
        this.func = func;
    }

    public String getWindows() {
        WindowInfo windows = new WindowInfo();
        windows.setType(type);
        windows.setInfo(content);
        windows.addButton(new Button(func, null));
        return JsonUtils.object2String(windows);
    }

    public String getContent() {
        return content;
    }
}
